﻿using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using System.ComponentModel;
using static Modules.Notify.NotifyConstants;

namespace Modules.Entitys
{
    /// <summary>
    /// 系统通知
    ///</summary>
    [TableName("sys_notify")]
    [Description("系统通知")]
    [PrimaryKey("id", AutoIncrement = false)]
    [CacheSetting(true)]
    [Serializable]
    public class SysNotify : IEntity
    {
        /// <summary>
        /// 系统通知Id
        ///</summary>
        [Column("id")]
        public string Id { get; set; }

        /// <summary>
        /// 发布内容
        ///</summary>
        [Column("content")]
        public string Content { get; set; }

        /// <summary>
        /// 限制查看人类型(1：所有人可见 2：建设单位可见 3：总承包可见 4：专业分包可见 5：劳务公司可见)
        ///</summary>
        [Column("limit_reader_type")]
        public 可见对象类型 LimitReaderType { get; set; }

        /// <summary>
        /// 是否置顶
        /// </summary>
        [Column("is_top")]
        public bool IsTop { get; set; } = false;

        /// <summary>
        /// 已读次数
        ///</summary>
        [Column("readed_num")]
        public int? ReadedNum { get; set; }

        /// <summary>
        /// 发布者
        ///</summary>
        [Column("creator")]
        public string Creator { get; set; }

        /// <summary>
        /// 发布时间
        ///</summary>
        [Column("create_time")]
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 修改时间
        ///</summary>
        [Column("update_time")]
        public DateTime? UpdateTime { get; set; }

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return this.Id; } }

        #endregion IEntity 成员
    }
}